package cn.com.open.itembank.service;


import cn.com.open.itembank.dto.*;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * The interface Item bank test paper remote service.
 */
@FeignClient(name = "item-paper-service")
public interface ItemBankTestPaperRemoteService {

    // region 新增相关

    // region 试卷主体新增

    /**
     * Add paper return model.
     *
     * @param id            题库ID
     * @param paperAddModel 试卷主体模型
     * @param appKey        AppKey
     * @return return model
     */
    @PostMapping(value = "/itembank/{id}/paper")
    ReturnModel addPaper(@PathVariable(value = "id") String id, @RequestBody PaperModel paperAddModel,
                         @RequestParam("appKey") String appKey);
    //endregion

    //region 试卷复制

    /**
     * 试卷复制
     *
     * @param id     题库ID
     * @param oldId  旧试卷ID
     * @param newId  新试卷ID
     * @param appKey AppKey
     * @return return model
     */
    @PostMapping(value = "/itembank/{id}/paper/{oldId}/copyto/{newId}")
    ReturnModel copyTestPaper(@PathVariable(value = "id") String id, @PathVariable(value = "oldId") String oldId, @PathVariable(value = "newId") String newId,
                              @RequestParam("appKey") String appKey);

    //endregion

    // region 更新相关

    //region 试卷名称更改

    /**
     * 试卷名称更改.
     *
     * @param itemBankId    题库id
     * @param id            试卷id
     * @param testPaperName 试卷名称
     * @param appKey        appkey
     * @return the return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{id}/title")
    ReturnModel updateTestPaperName(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                                    @RequestParam("c") String testPaperName, @RequestParam("appKey") String appKey);
    //endregion

    //region 发布试卷

    /**
     * 发布试卷.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @param publisher  发布者
     * @param appKey     appkey
     * @return the return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{id}/release")
    ReturnModel testPaperRelease(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                                 @RequestParam("publisher") String publisher, @RequestParam("appKey") String appKey);

    //endregion

    //region 取消试卷发布

    /**
     * 取消试卷发布.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @param appKey     appkey
     * @return the return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{id}/cancelrelease")
    ReturnModel cancelTestPaperRelease(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                                       @RequestParam("appKey") String appKey);

    //endregion

    //region 切换试卷状态

    /**
     * 切换试卷状态.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @param appKey     appkey
     * @return the return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{id}/status")
    ReturnModel updateStatus(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                             @RequestParam("appKey") String appKey);

    //endregion


    // endregion

    // region 查询相关

    //region 获取指定题库下指定试卷

    /**
     * 获取指定题库下指定试卷全部信息.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @return 试卷模型 full item
     */
    @GetMapping(value = "/itembank/{itemBankId}/paper/{id}")
    ReturnModel getFullPaper(@PathVariable("itemBankId") String itemBankId, @PathVariable(value = "id") String id);

    /**
     * 获取指定题库下指定试卷答案信息.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @return 试卷答案模型 item answer
     */
    @GetMapping(value = "/itembank/{itemBankId}/paper/{id}/answer")
    ReturnModel getPaperAnswer(@PathVariable("itemBankId") String itemBankId, @PathVariable(value = "id") String id);

    /**
     * 获取指定题库下指定试卷不含答案的信息.
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @return 试卷无答案模型 item without answer
     */
    @GetMapping(value = "/itembank/{itemBankId}/paper/{id}/withoutanswer")
    ReturnModel getPaperWithoutAnswer(@PathVariable("itemBankId") String itemBankId, @PathVariable(value = "id") String id);
    //endregion

    //region 获取所有试卷列表

    /**
     * 获取所有试卷列表.
     *
     * @param itemBankId         the item bank id
     * @param testPaperSearchDto the map
     * @return the paper list
     */
    @PostMapping(value = "/itembank/{itemBankId}/paper/list")
    ReturnModel getPaperList(@PathVariable(value = "itemBankId") String itemBankId, @RequestBody TestPaperSearchDto testPaperSearchDto);

    //endregion

    // endregion

    // region 删除相关

    /**
     * Delete auto return model.
     *
     * @param itemBankId   the item bank id
     * @param paperId      the paper id
     * @param isAutoDelete the is auto delete
     * @param appKey       the app key
     * @return return model
     */
    @DeleteMapping(value = "/itembank/{id}/paper/{paperid}/deleteauto")
    ReturnModel deleteAuto(@PathVariable(value = "id") String itemBankId, @PathVariable(value = "paperid") String paperId,
                           @RequestParam("isAutoDelete") boolean isAutoDelete, @RequestParam("appKey") String appKey);

    // endregion

    //region 大题相关

    //region 大题自身删除

    /**
     * 大题自身删除
     *
     * @param itemBankId the item bank id
     * @param id         the id
     * @param index      the index
     * @param appKey     the app key
     * @return return model
     */
    @DeleteMapping(value = "/itembank/{itemBankId}/paper/{id}/section/{index}")
    ReturnModel removeSection(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                              @PathVariable("index") String index, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题所含试题删除

    /**
     * 大题所含试题删除
     *
     * @param itemBankId the item bank id
     * @param id         the id
     * @param index      the index
     * @param questionId the question id
     * @param appKey     the app key
     * @return return model
     */
    @DeleteMapping(value = "/itembank/{itemBankId}/paper/{id}/section/{index}/question/{questionId}")
    ReturnModel removeSectionQuestion(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id
            , @PathVariable("index") String index, @PathVariable("questionId") String questionId, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题批量试题删除

    /**
     * 大题批量试题删除
     *
     * @param itemBankId the item bank id
     * @param id         the id
     * @param idList the question idList
     * @param appKey     the app key
     * @return return model
     */
    @DeleteMapping(value = "/itembank/{itemBankId}/paper/{id}/question")
    ReturnModel removeSectionQuestionList(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id
            ,@RequestBody IdentifierArray idList, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题内容修改

    /**
     * 大题内容修改
     *
     * @param id           题库id
     * @param paperId      试卷id
     * @param index        大题序号
     * @param sectionTitle 大题标题
     * @param shuf         是否乱序
     * @param appKey       the app key
     * @return return model
     */
    @PutMapping(value = "/itembank/{id}/paper/{paperId}/section/{index}")
    ReturnModel updateSectionContent(@PathVariable(value = "id") String id, @PathVariable(value = "paperId") String paperId,
                                     @PathVariable("index") String index, @RequestParam("c") String sectionTitle, @RequestParam("shuf") boolean shuf, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题试题分值修改

    /**
     * 大题试题分值修改
     *
     * @param itemBankId 题库id
     * @param id         试卷id
     * @param index      大题序号
     * @param questionId 试题id
     * @param score      试题分值
     * @param appKey     the app key
     * @return return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{id}/section/{index}/question/{questionId}/score")
    ReturnModel updateSectionQuestionScore(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "id") String id,
                                           @PathVariable("index") String index, @PathVariable("questionId") String questionId, @RequestParam("s") double score, @RequestParam("appKey") String appKey);

    //endregion

    //region 大题所有试题分值修改

    /**
     * Update section score return model.
     *
     * @param itemBankId  题库ID
     * @param testPaperId 试卷ID
     * @param index       大题序号
     * @param score       分数
     * @param appKey      AppKey
     * @return return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{testPaperId}/section/{index}/score")
    ReturnModel updateSectionScore(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "testPaperId") String testPaperId,
                                   @PathVariable("index") String index, @RequestParam("s") double score, @RequestParam("appKey") String appKey);

    //endregion

    //region 大题顺序调整

    /**
     * Update section order return model.
     *
     * @param itemBankId  题库ID
     * @param testPaperId 试卷ID
     * @param index       大题序号
     * @param m           上移/下移
     * @param appKey      AppKey
     * @return return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{testPaperId}/section/{index}/movement")
    ReturnModel updateSectionOrder(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "testPaperId") String testPaperId,
                                   @PathVariable("index") String index, @RequestParam("m") boolean m, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题试题顺序调整

    /**
     * Update section question order return model.
     *
     * @param itemBankId  题库ID
     * @param testPaperId 试卷ID
     * @param index       大题序号
     * @param questionId  试题id
     * @param m           上移/下移
     * @param appKey      AppKey
     * @return return model
     */
    @PutMapping(value = "/itembank/{itemBankId}/paper/{testPaperId}/section/{index}/questionId/{questionId}/movement")
    ReturnModel updateSectionQuestionOrder(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "testPaperId") String testPaperId,
                                           @PathVariable("index") String index, @PathVariable("questionId") String questionId, @RequestParam("m") boolean m, @RequestParam("appKey") String appKey);
    //endregion

    //region 大题试题关联新增

    /**
     * Add section question return model.
     *
     * @param itemBankId  题库ID
     * @param testPaperId 试卷ID
     * @param questionId  试题id
     * @param shuf        是否乱序
     * @param score       分数
     * @param appKey      the app key
     * @return the return model
     */
    @PostMapping(value = "/itembank/{itemBankId}/paper/{testPaperId}/question/{questionId}")
    ReturnModel addSectionQuestion(@PathVariable(value = "itemBankId") String itemBankId, @PathVariable(value = "testPaperId") String testPaperId,
                                   @PathVariable(value = "questionId") String questionId,
                                   @RequestParam("shuf") boolean shuf,
                                   @RequestParam("s") double score,
                                   @RequestParam("appKey") String appKey);

    //endregion

    //region 大题试题新增

    /**
     * Add section question return model.
     *
     * @param itemBankId    题库ID
     * @param paperId       试卷ID
     * @param questionModel 试题模型
     * @param shuf          是否乱序
     * @param score         分数
     * @param appKey        the app key
     * @return the return model
     */
    @PostMapping(value = "/itembank/{itemBankId}/paper/{paperId}/addnewquestion")
    ReturnModel addNewQuestion(@PathVariable(value = "itemBankId") String itemBankId,
                               @PathVariable(value = "paperId") String paperId,
                               @RequestBody QuestionModel questionModel,
                               @RequestParam("shuf") boolean shuf,
                               @RequestParam("score") double score,
                               @RequestParam("appKey") String appKey);

    //endregion

    //region 大题批量试题关联新增

    /**
     * Add section question return model.
     *
     * @param itemBankId 题库ID
     * @param paperId    试卷ID
     * @param questionId 试题id
     * @param score      分数
     * @param appKey     the app key
     * @return the return model
     */
    @PostMapping(value = "/itembank/{id}/paper/{paperId}/addexistquestionlist")
    ReturnModel addExistQuestionList(@PathVariable(value = "id") String itemBankId, @PathVariable(value = "paperId") String paperId,
                                     @RequestParam("questionId") List<String> questionId,
                                     @RequestParam("score") double score,
                                     @RequestParam("appKey") String appKey);

    /**
     * 大题试题修改
     *
     * @param id            题库ID
     * @param paperId       试卷ID
     * @param index         大题序号
     * @param questionId    试题id
     * @param copy          是否复制
     * @param questionModel 试题模型
     * @param appKey        所属AppKey
     * @return return model
     */
    @PutMapping(value = "/itembank/{id}/paper/{paperId}/section/{index}/question/{questionId}/edit")
    ReturnModel updateSectionQuestion(@PathVariable(value = "id") String id, @PathVariable(value = "paperId") String paperId, @PathVariable(value = "index") String index,
                                      @PathVariable(value = "questionId") String questionId, @RequestParam("copy") Boolean copy, @RequestBody QuestionModel questionModel, @RequestParam("appKey") String appKey);

    //endregion

    //endregion

}
